<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加设备 - 禾行通</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
    <div class="container mt-4">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="/vehicles">设备管理</a></li>
                        <li class="breadcrumb-item active">添加设备</li>
                    </ol>
                </nav>
                
                <div class="card">
                    <div class="card-header">
                        <h4><i class="fas fa-plus"></i> 添加新设备</h4>
                    </div>
                    <div class="card-body">
                        <form th:action="@{/vehicles/add}" th:object="${vehicle}" method="post">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label class="form-label">设备名称 *</label>
                                        <input type="text" class="form-control" th:field="*{name}" required>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label class="form-label">设备类
                                        <select class="form-select" id="type" th:field="*{type}" required>
                                            <option value="">请选择设备类型</option>
                                            <option value="播种机">播种机</option>
                                            <option value="收割机">收割机</option>
                                            <option value="喷药机">喷药机</option>
                                            <option value="施肥机">施肥机</option>
                                            <option value="除草机">除草机</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label for="firmwareVersion" class="form-label">固件版本</label>
                                        <input type="text" class="form-control" id="firmwareVersion" th:field="*{firmwareVersion}">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label for="maxSpeed" class="form-label">最大速度 (km/h)</label>
                                        <input type="number" class="form-control" id="maxSpeed" th:field="*{maxSpeed}" step="0.1">
                                    </div>
                                </div>
                            </div>
                            
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label for="workingMode" class="form-label">工作模式</label>
                                        <select class="form-select" id="workingMode" th:field="*{workingMode}">
                                            <option value="">请选择工作模式</option>
                                            <option value="自动">自动</option>
                                            <option value="半自动">半自动</option>
                                            <option value="手动">手动</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="mb-3">
                                        <label for="batteryLevel" class="form-label">电池电量 (%)</label>
                                        <input type="number" class="form-control" id="batteryLevel" th:field="*{batteryLevel}" min="0" max="100">
                                    </div>
                                </div>
                            </div>
                            
                            <div class="mb-3">
                                <label for="sensorConfig" class="form-label">传感器配置</label>
                                <textarea class="form-control" id="sensorConfig" th:field="*{sensorConfig}" rows="3"></textarea>
                            </div>
                            
                            <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                                <a href="/vehicles" class="btn btn-secondary me-md-2">取消</a>
                                <button type="submit" class="btn btn-primary">保存</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>